const GnomeSession = imports.misc.gnomeSession;
const LoginManager = imports.misc.loginManager;
const Main = imports.ui.main;
+const Screenshot = imports.ui.screenshot;
const LOCKDOWN_SCHEMA = 'org.gnome.desktop.lockdown';
const LOGIN_SCREEN_SCHEMA = 'org.gnome.login-screen';
const SUSPEND_ACTION_ID = 'suspend';
const SWITCH_USER_ACTION_ID = 'switch-user';
const LOCK_ORIENTATION_ACTION_ID = 'lock-orientation';
+const SCREENSHOT_UI_ACTION_ID = 'open-screenshot-ui';
let _singleton = null;
keywords: tokenizeKeywords(_('lock orientation;unlock orientation;screen;rotation')),
available: false,
});
+ this._actions.set(SCREENSHOT_UI_ACTION_ID, {
+ // Translators: The name of the screenshot UI action in search
+ name: C_('search-result', 'Take a Screenshot'),
+ iconName: 'applets-screenshooter-symbolic',
+ // Translators: A list of keywords that match the screenshot UI action, separated by semicolons
+ keywords: tokenizeKeywords(_('screenshot;screencast;snip;capture;record')),
+ available: true,
+ });
this._loginScreenSettings = new Gio.Settings({ schema_id: LOGIN_SCREEN_SCHEMA });
this._lockdownSettings = new Gio.Settings({ schema_id: LOCKDOWN_SCHEMA });
case LOCK_ORIENTATION_ACTION_ID:
this.activateLockOrientation();
break;
+ case SCREENSHOT_UI_ACTION_ID:
+ this.activateScreenshotUI();
+ break;
}
}
this._loginManager.suspend();
}
+
+ activateScreenshotUI() {
+ if (!this._actions.get(SCREENSHOT_UI_ACTION_ID).available)
+ throw new Error('The screenshot UI action is not available!');
+
+ if (this._overviewHiddenId)
+ return;
+
+ this._overviewHiddenId = Main.overview.connect('hidden', () => {
+ Main.overview.disconnect(this._overviewHiddenId);
+ delete this._overviewHiddenId;
+ Screenshot.showScreenshotUI();
+ });
+ }
});